clear; clc; close all;


a = 0.1;
b = 0.1;
c = 0.2;     % Fig.10 时 c=0.2
k = 1.85;

% 选取四组初始条件, x0 固定为 0.1，q0 值不同
ICs = [
    0.1,  10;   % 绿色
    0.1,  3;    % 蓝色
    0.1,  0;    % 青色
    0.1, -5;    % 红色
];
colors = {'g','b','c','m'};  % 对应四条轨迹的颜色

N_transient = 40000;  % 暂态迭代步数
N_plot = 50000;       % 用于绘制的步数


hold on; grid on;
xlabel('x'); ylabel('q');
title('单稳态共存吸引子 (c=0.2, k=1.85)', 'FontSize',10);

for i = 1:size(ICs,1)
    x = ICs(i,1);
    q = ICs(i,2);
    % 先迭代暂态步，去除初始效应
    for t = 1:N_transient
        [x, q] = mptm(x, q, a, b, c, k);
    end
    
    % 记录后续 N_plot 步的轨迹
    orbit_x = zeros(1, N_plot);
    orbit_q = zeros(1, N_plot);
    orbit_x(1) = x;
    orbit_q(1) = q;
    for t = 2:N_plot
        [orbit_x(t), orbit_q(t)] = mptm(orbit_x(t-1), orbit_q(t-1), a, b, c, k);
    end
    
    % 绘制该初始条件下的轨迹
    plot(orbit_x, orbit_q, '.', 'Color', colors{i}, 'MarkerSize', 3);
end